package com.jinke.api.modules.base.service;

import com.jinke.api.modules.app.enums.ChannelPlatform;
import com.jinke.api.modules.third.changYunShip.service.IChangYunShipService;
import com.jinke.api.modules.third.dqpost.service.DqpostService;
import com.jinke.api.modules.third.easypost.service.EasyPostService;
import com.jinke.api.modules.third.ezeeship.service.EzeeShipService;
import com.jinke.api.modules.third.ezeeship2.service.EzeeShip2Service;
import com.jinke.api.modules.third.myus56.service.IMyus56Service;
import com.jinke.api.modules.third.shipBridge.service.ShipBridgeService;
import com.jinke.api.modules.third.shipber.service.ShipberService;
import com.jinke.api.modules.third.shippo.service.ShippoService;
import com.jinke.api.modules.third.sjgj.service.SjgjService;
import com.jinke.api.modules.third.sjgj2.service.Sjgj2Service;
import com.jinke.api.modules.third.test.service.impl.TestServiceImpl;
import com.jinke.api.modules.third.uniuni.service.UniUniService;
import com.jinke.api.modules.ums.model.Channel;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author macro
 * @since 2024-01-13
 */
@Component
public class ShipFactory {
    @Resource
    private EzeeShipService ezeeShipService;
    @Resource
    private EzeeShip2Service ezeeShip2Service;
    @Resource
    private SjgjService sjgjService;
    @Resource
    private Sjgj2Service sjgj2Service;
    @Resource
    private EasyPostService easyPostService;
    @Resource
    private DqpostService dqpostService;
    @Resource
    private ShipberService shipberService;
    @Resource
    private TestServiceImpl testService;
    @Resource
    private IChangYunShipService iChangYunShipService;
    @Resource
    private IMyus56Service iMyus56Service;
    @Resource
    private ShipBridgeService shipBridgeService;

    @Resource
    private UniUniService uniUniService;
    @Resource
    private ShippoService shippoService;

    public BaseShipService getBaseShipService(Channel channel) {
        BaseShipService baseShipService;
        Integer channelPlatformId = channel.getChannelPlatformId();
        if (ChannelPlatform.EZEE_SHIP.getValue() == channelPlatformId) {
            baseShipService = ezeeShipService;
        } else if (ChannelPlatform.SJGJWL.getValue() == channelPlatformId) {
            baseShipService = sjgjService;
        } else if (ChannelPlatform.EASYPOST.getValue() == channelPlatformId) {
            baseShipService = easyPostService;
        } else if (ChannelPlatform.EZEE2_SHIP.getValue() == channelPlatformId) {
            baseShipService = ezeeShip2Service;
        } else if (ChannelPlatform.SJGJWL2.getValue() == channelPlatformId) {
            baseShipService = sjgj2Service;
        } else if (ChannelPlatform.SHIPBER.getValue() == channelPlatformId) {
            baseShipService = shipberService;
        } else if (ChannelPlatform.Test.getValue() == channelPlatformId) {
            baseShipService = testService;
        } else if (ChannelPlatform.CHANG_YUN_SHIP.getValue() == channelPlatformId) {
            baseShipService = iChangYunShipService;
        } else if (ChannelPlatform.MY_US_56.getValue() == channelPlatformId) {
            baseShipService = iMyus56Service;
        } else if (ChannelPlatform.SHIP_BRIDGE.getValue() == channelPlatformId) {
            baseShipService = shipBridgeService;
        } else if (ChannelPlatform.UNI_UNI.getValue() == channelPlatformId) {
            baseShipService = uniUniService;
        }else if (ChannelPlatform.SHIPPO.getValue() == channelPlatformId) {
            baseShipService = shippoService;
        }
        else {
            baseShipService = dqpostService;
        }
        return baseShipService;
    }
}
